package pl.wroc.uni.ii.pastuszka.algorithms.evolutionary.terminators;

import java.util.List;

import pl.wroc.uni.ii.pastuszka.algorithms.evolutionary.Individual;

public class FixedNumberOfIterations implements TerminationCondition {

  private int nrOfIterations;
  private int currentIteration = 0;

  public FixedNumberOfIterations(int nrOfIterations) {
    this.nrOfIterations = nrOfIterations;
  }

  @Override
  public void initialize(List<Individual> population) {

  }

  @Override
  public void finishIteration(List<Individual> population) {
    ++currentIteration;

  }

  @Override
  public boolean terminate() {
    return currentIteration >= nrOfIterations;
  }

}
